﻿using TencentCloud.Common;
using TencentCloud.Sms.V20210111;
using TencentCloud.Sms.V20210111.Models;
using Newtonsoft.Json;
using Service.Framework.Packet;

namespace micro_test
{
    [TestClass]
    public sealed class SMS
    {

        [TestMethod]
        public void TestMethod1()
        {
            Credential cred = new Credential
            {
                SecretId = "AKIDIaidLq7A1f6LPGuKZbm5EAtOkuvmRwGN",
                SecretKey = "0qW0LVcXI4f6KRN5GMUccP0c8SaWN0Tj"
            };

            var dd = R.OkData(null);

            //把对象序列化成json字符串
            string jsonString = JsonConvert.SerializeObject(dd);


            //把json字符串反序列化为对象
            R<bool?> r = JsonConvert.DeserializeObject<R<bool?>>(jsonString);





            SmsClient smsClient = new SmsClient(cred, "ap-guangzhou");

            SendSmsRequest sendSmsRequest = new SendSmsRequest()
            {
                SmsSdkAppId = "1400956565",
                SignName = "荆门互道",
                TemplateId = "2369193",
                TemplateParamSet = new string[] { "123456", "5" },
                PhoneNumberSet = new string[] { "17608422149" },
            };
            var sendSmsResponse = smsClient.SendSms(sendSmsRequest).Result;
            if (sendSmsResponse.SendStatusSet.Any(s => !"Ok".Equals(s.Code)))
            {

            }
            //sendSmsResponse.SendStatusSet

            Assert.IsTrue(true);
        }


    }
}


